package ReserveController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import Dao.ReserveDao;

public class Reserveform implements Controller{
	
	private ReserveDao reserveDao;
	
	public void setReserveDao(ReserveDao reserveDao) {
		this.reserveDao = reserveDao;
	}
	
	@Override
	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		
		Object list = null;
		ModelAndView mav = new ModelAndView();
		
		String R_NO = null;
		
		if(arg0.getParameter("room")!=null){
			R_NO = arg0.getParameter("room").toString();
			list = reserveDao.getRoom(R_NO);
		} else {
			list = reserveDao.getRooms();
		}
		mav.addObject("list",list);
		mav.setViewName("reserveform");
		
		return mav;
	}
	
}
